import { PureComponent } from 'react';
import moment from 'moment';
import {
    Row,
    Col,
    Form,
    Input,
    Select,
    Modal,
    Cascader,
    DatePicker
} from 'antd';
const FormItem = Form.Item;
const { Option } = Select;
import { dicTextByCodePcode,dicListByPcode } from '@/utils/dictionary'


@Form.create()
class CreateForm extends PureComponent {

	constructor(props) {
	    super(props);
	    this.state = {

	    }
	}


	okHandle = () => {
		const { form,handleAdd } = this.props;

	    form.validateFields((err, fieldsValue) => {
		        if (err) return;
		        form.resetFields();
			   	if(fieldsValue.a1704) {
			   				fieldsValue.a1704 = moment(fieldsValue.a1704._d).format("YYYY-MM-DD");
			   			}
			    handleAdd(fieldsValue,'CheckInfo');
		});
	};


	resetButton = () => {

	};

  render() {
    const {form: {getFieldDecorator}, modalVisibleByCheckInfo,handleModalVisible} = this.props;

return (
    <Modal
width={800}
destroyOnClose
title="添加考核信息"
visible={modalVisibleByCheckInfo}
onOk={this.okHandle}
onCancel={() => handleModalVisible(false,"CheckInfo")}
afterClose={() => this.resetButton()}
>
<Form  layout="vertical">
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		    <Col md={12} sm={24}>
		      <FormItem  label="考核年度">
		          {getFieldDecorator('a1701', {
		          rules: [{ required: false, message: '请输入1-10个字符',max: 10}],
		          })(<Input placeholder="1-10个字符"/>)}
		      </FormItem>
		    </Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="考核结论">
		          {getFieldDecorator('a1723', {
		            rules: [{ required: false, message: '请选择'}],
		          })(
		            <Select labelInValue placeholder="请选择" style={{ width: '100%' }}>
		            	{dicListByPcode('AE') != undefined?dicListByPcode('AE').map((item,index) => {
		            		return <Option value={item.DICTVALUE}>{item.DESCRIPTION}</Option>
		            	}):null}
		            </Select>
		          )}
		      </FormItem>
		    </Col>

		</Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		    <Col md={12} sm={24}>
		      <FormItem  label="考核日期">
		          {getFieldDecorator('a1704',{
		          	    })(<DatePicker  format="YYYY-MM-DD" style={{ width: '100%' }} placeholder="请选择"/>)}
		          	</FormItem>
		    </Col>
		    <Col md={12} sm={24}>
		      <FormItem  label="考核单位名称">
		          {getFieldDecorator('a1707_1', {
		          rules: [{ required: false, message: '1-10个字符'}],
		          })(<Input placeholder="1-10个字符"/>)}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

		<Col md={12} sm={24}>
		      <FormItem  label="考核单位代码">
		          {getFieldDecorator('a1707_2', {
		          rules: [{ required: false, message: '1-10个字符'}],
		          })(
		          	<Input placeholder="1-10个字符"/>
		          )}
		      </FormItem>
		    </Col>

		    <Col md={12} sm={24}>
		      <FormItem  label="参加考核的应到人数">
		          {getFieldDecorator('a1710',{
		            rules: [{ required: false, message: '1-10个字符！'}],
		          })(
		          	<Input placeholder="1-10个字符"/>
		          )}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		    <Col md={12} sm={24}>
		      <FormItem  label="实到考核人数">
		          {getFieldDecorator('a1712', {
		          rules: [{ required: false, message: '1-10个字符'}],
		          })(
		            <Input placeholder="1-10个字符"/>
		          )}
		      </FormItem>
		    </Col>
		    <Col md={12} sm={24}>
		      <FormItem  label="考核优秀得票数">
		          {getFieldDecorator('a1713', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(<Input placeholder="1-40个字符" />)}
		      </FormItem>
		    </Col>

		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>


		    <Col md={12} sm={24}>
		      <FormItem  label="考核称职(合格)得票数">
		          {getFieldDecorator('a1715', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(<Input placeholder="1-40个字符" />)}
		      </FormItem>
		    </Col>

		   	<Col  md={12} sm={24}>
		   	  <FormItem  label="考核基本称职(基本合格)得票数">
		   	      {getFieldDecorator('a1717', {
		   	        rules: [{ required: false, message: '1-40个字符'}],
		   	        })(<Input placeholder="1-40个字符" />)}
		   	        </FormItem>
		   	</Col>

		</Row>
		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="考核不称职(不合格)得票数">
			      {getFieldDecorator('a1719', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			       <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="弃权票数">
		        {getFieldDecorator('a1721', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
		          <Input placeholder="1-40个字符" />
		        )}
		    </FormItem>
		  </Col>
		</Row>

		<Row gutter={{ md: 8, lg: 24, xl: 48 }}>

			<Col md={12} sm={24}>
			  <FormItem  label="考核组成员">
			      {getFieldDecorator('a1709', {
			        rules: [{ required: false, message: '1-40个字符'}],
			        })(
			       <Input placeholder="1-40个字符" />
			      )}
			  </FormItem>
			</Col>

		  <Col md={12} sm={24}>
		    <FormItem  label="考核备注">
		        {getFieldDecorator('a1725', {
		          rules: [{ required: false, message: '1-40个字符'}],
		          })(
		          <Input placeholder="1-40个字符" />
		        )}
		    </FormItem>
		  </Col>
		</Row>

</Form>
</Modal>
);
  }

}

export default CreateForm;
